<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/css/plugins/webuploader/webuploader.css}" rel="stylesheet"/>
<link th:href="@{/css/demo/webuploader-demo.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <div class="col-sm-12 select-info table-striped">
        <table id="bootstrap-table" class="table text-nowrap" data-height="550" data-show-columns="true" data-mobile-responsive="true"></table>
    </div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "module/productsUpload"
    $(function() {
        var options = {
            url: prefix + "/list",
            modalName: "商品批量上传",
            search: false,
            sortName: "createdate",
            sortOrder: "desc",
            showFooter: true,
            columns: [
                {
                    field : 'id',
                    title : '编号',
                    visible: false
                },
                {
                    title: 'serialNumber',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;     //通过table的#id 得到每页多少条
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber; //通过table的#id 得到当前第几页
                        return pageSize * (pageNumber - 1) + index + 1;    // 返回每条的序号： 每页条数 *（当前页 - 1 ）+ 序号
                    }
                },
                {
                    field : 'createBy',
                    title : 'createBy'
                },
                {
                    field : 'createDate',
                    title : 'createDate'
                },
                {
                    field : 'companyName',
                    title : 'companyName'
                },
                {
                    field : 'fileUrl',
                    title : 'productName',
                    formatter: function (value, row, index) {
                        return '<a href="javascript:;" data-text="productXls/'+ value +'" class="down">'+value+'</a>';
                    }
                },
                {
                    field : 'counts',
                    title : 'counts'
                },
                {
                    field : '',
                    title : 'remark'
                }
                ]
        };
        $.table.init(options);
    });


    $('body').on('click','.down',function () {
        var path = $(this).attr('data-text');
        form = $('<form></form>');
        form.attr('action','/module/ordersHead/down');
        form.attr('method','post');
        input = $("<input type='hidden' name='fileUrl' />")
        input.attr('value',path);
        form.append(input);
        form.appendTo("body")
        form.css('display','none')
        form.submit();
    });
</script>

</body>
</html>
